Given an array of integers, find the one that appears an odd number of times.
There will always be only one integer that appears an odd number of times.
找出陣列中出現基數次數的數字
(ns find-the-odd-int)
(defn find-odd [xs]
(first (keys (filter (comp odd? second) (frequencies xs)))))
(first coll)
;; Returns the first item in the collection.
(first [1 2]) ; 1
(second x) (fnext x)
;; Same as (first (next x))
(second [1 2]) ; 2
(next coll)
;; Returns a seq of the items after the first.
(next [1 2]) ; 2
(comp)(comp f)(comp f g)(comp f g & fs)
(filter (comp not zero?) [0 1 0 2 0 3 0]) ;; (1 2 3)